<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>变长参数</title>
  <script>
    /**
     * 1. 变长参数
     * 案例：打印传入的所有的参数之和。
     */
    function fun1(...args){
      let sum = 0
      for (let i = 0; i < args.length; i++) {
        sum += args[i]
      }
      return sum
    }
    let s = fun1(1,2,3,4,5)
    console.log("s = ",s)
  </script>
</head>
<body>

</body>
</html>
